<div class="content-titulo">
    
    <div class="filtro">
        <form id="form_filtro" method="get" action="">
            <i>Filtrar</i>
            <?php 
                $f_cur = dominio::Orcamento('0');
                unset($f_cur[1]);
                unset($f_cur[2]);
                
                $html = '<select id="filtrosta" name="filtrosta">';
                $html .= '<option value="">Todos</option>';
                foreach($f_cur as $key => $r){   
                    $select = $this->filtrosta > '' && $this->filtrosta == $key ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$key.'">'.$r.'</option>'; 
                }
                echo $html .= '</select>';
            /* 
            ?>
             &nbsp;
             <?php 
                
                $query = 'SELECT SQL_CACHE CTS_ID,CTS_NOM FROM CATSEGMENTO WHERE CTS_STA = 1 ORDER BY CTS_ORD ASC';
                $row = $this->db->fetchAll($query);
                
                $html = '<select id="filtroseg" name="filtroseg">';
                $html .= '<option value="0">Todos segmentos</option>';
                foreach($row as $r){   
                    $select = $this->filtroseg > '' && $this->filtroseg == $r['CTS_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['CTS_ID'].'">'.$r['CTS_NOM'].'</option>'; 
                }
                echo $html .= '</select>';
            */
            ?>
             &nbsp;
            <input type="text" id="datfiltro" name="datfiltro" value="<?php echo $this->datfiltro; ?>" placeholder="Data" />
             &nbsp;
            <input type="text" name="dscfiltro" value="<?php echo $this->dscfiltro; ?>" placeholder="Empresa" />
            
            <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
        </form>
    </div>
    
    <h2><?php echo $this->titulo;?></h2>
</div>

<div class="content-list">
    
<?php foreach ($this->result as $row) { 
    $query = 'SELECT SQL_CACHE * FROM PRODUTO WHERE PRO_ID = '.$row['PRO_ID'];
    $pro = $this->db->fetchRow($query);

    $query = 'SELECT SQL_CACHE CTS_ID,CTS_NOM FROM CATSEGMENTO WHERE CTS_ID = '.$row['CTS_ID'];
    $seg = $this->db->fetchRow($query)
?>
    <div class="item" style="height:100px">    
        
        <div class="col" style="min-width: 250px">
            <p><strong>Empresa: </strong><?php echo $row['SOL_EMP']; ?></p>
            <p><strong>Solicitante: </strong><?php echo $row['SOL_NOM']; ?></p>
            <p><strong>Telefone: </strong><?php echo $row['SOL_TEL']; ?></p>
            <p><strong>E-mail: </strong><?php echo $row['SOL_EML']; ?></p>
        </div>
         
        <div class="col" style="width: 200px">
            <p><strong>Solicitação: </strong><?php echo Datetools::amd_dma($row['ORC_DATA']); ?> <?php echo substr($row['ORC_HOR'],0,5); ?></p>
            <?php if($row['ORC_STA'] > 1){ ?>
            <p><strong>Orçado: </strong><?php echo Datetools::amd_dma($row['ORC_DATAORC']); ?> <?php echo substr($row['ORC_HORORC'],0,5); ?></p>
            <?php } ?>
            <p><strong>Responsável: </strong><?php echo $row['USU_NOME']; ?></p>
            
        </div>
        
        <div class="col" style="width: 200px"> 
            <p><strong>Código: <?php echo $row['ORC_ID']; ?></strong></p>
            <p><strong>Produto: </strong><?php echo $pro['PRO_NOM']; ?></p> 
            <?php if($seg['CTS_ID'] > 0) { ?>
            <p><strong>Segmento: </strong><?php echo $seg['CTS_NOM']; ?></p>
            <?php } ?>
            <p><strong>Status: </strong> 
                <strong class="<?php echo dominio::getOrcamentoCor($row['ORC_STA']); ?>" style="padding: 2px 5px;border-radius:3px;" >
                    <?php echo dominio::getOrcamento($row['ORC_STA']); ?>
                </strong>
            </p>
            
        </div>
        
        
        <div class="btn-actions" style="padding-top: 10px;">
            <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['ORC_ID'])); ?>">Editar</a><?php }?>
        </div>

      </div>
    <?php } ?>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
<script>
dataPicker($('#datfiltro'));
</script>